package com.gouaixin.bee.beeframework2.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.gouaixin.bee.beeframework2.R;

import java.util.ArrayList;
import java.util.HashMap;

public class KanguoAdapter extends BaseAdapter {



	Context context;
//	ArrayList<HashMap<String, Object>> al;
	LayoutInflater mInflater;

    public KanguoAdapter(Context context) {
        this.context = context;
//		this.al = al;
        mInflater = LayoutInflater.from(context);

    }


	public KanguoAdapter(Context context, ArrayList<HashMap<String, Object>> al) {
		this.context = context;
//		this.al = al;
		mInflater = LayoutInflater.from(context);
		
	}

	public int getCount() {
		return 10;
	}

	public Object getItem(int position) {
		return null;
	}

	public long getItemId(int position) {
		return position;
	}


	
	
	public View getView(int position, View convertView, ViewGroup parent) {

		ViewHolder viewHolder;
		
		if(convertView == null){
			
			convertView = mInflater.inflate(R.layout.tuijian_item, null);
			viewHolder = new ViewHolder();

			viewHolder.icon = (ImageView) convertView.findViewById(R.id.icon);
			viewHolder.qianming = (TextView) convertView.findViewById(R.id.qianming);
			viewHolder.name = (TextView) convertView.findViewById(R.id.name);
			viewHolder.dianzanNum = (TextView) convertView.findViewById(R.id.dianzanNum);
			viewHolder.age = (TextView) convertView.findViewById(R.id.age);
			viewHolder.height = (TextView) convertView.findViewById(R.id.height);
			viewHolder.address = (TextView) convertView.findViewById(R.id.address);
            viewHolder.zhaohu = (ImageView) convertView.findViewById(R.id.zhaohu);
            viewHolder.guanzhu = (ImageView) convertView.findViewById(R.id.guanzhu);

			convertView.setTag(viewHolder);

		}else {

			viewHolder = (ViewHolder) convertView.getTag();
		}

//		HashMap<String, Object> map = al.get(position);
		viewHolder.name.setText("看过对象"+position);

//        viewHolder.zhaohu.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//
//                if(isZhaohu[position]==false){
//
//
//                    String id = null;
//                    try {
//                        jsonOb = (JSONObject) jsonArray.opt(position);
//                        id = jsonOb.getString("id");
//                        String cid = PreferencesUtils.getString(context, "id", "");
//                        String text = "你好，可以和我聊聊吗？";
//                        String time =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
//
//                        addMessage(id, cid, text, time,position);
//
//                    } catch (JSONException e) {
//                        e.printStackTrace();
//                    }
//
//                }else {
//                    AbToastUtil.showToast(context, "已打招呼！");
//                }
//
//
//
//
//
//            }
//        });



        return convertView;
	}
	/**
	 * �ڲ���
	 */
	class ViewHolder {
        ImageView icon;
		TextView qianming;
		TextView name;
		TextView dianzanNum;
		TextView age;
		TextView height;
		TextView address;
        ImageView zhaohu;
        ImageView guanzhu;
	}
	
	
	
	
	
}
